using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace tutors_clus.Models.Mapping
{
    public class studentMap : EntityTypeConfiguration<student>
    {
        public studentMap()
        {
            // Primary Key
            this.HasKey(t => t.id_stu);

            // Properties
            this.Property(t => t.id_stu)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.fullname_stu)
                .HasMaxLength(100);

            this.Property(t => t.address_stu)
                .HasMaxLength(200);

            this.Property(t => t.avatar_stu)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("students");
            this.Property(t => t.id_stu).HasColumnName("id_stu");
            this.Property(t => t.fullname_stu).HasColumnName("fullname_stu");
            this.Property(t => t.birthday_stu).HasColumnName("birthday_stu");
            this.Property(t => t.address_stu).HasColumnName("address_stu");
            this.Property(t => t.registered_stu).HasColumnName("registered_stu");
            this.Property(t => t.avatar_stu).HasColumnName("avatar_stu");
        }
    }
}
